/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.servicoimpl;

import br.com.deployment.entity.orcamento.OrcamentoCampo;
import br.com.deployment.interfaces.OrcamentoCampoDaoIn;
import br.com.deployment.servico.OrcamentoCampoServico;
import br.com.deployment.utilitario.Msg;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.EJBAccessException;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 *
 * @author luciano
 */
@Stateless
@LocalBean
public class OrcamentoCampoServicoImpl implements OrcamentoCampoServico{
    
    @EJB
    OrcamentoCampoDaoIn orcamentoCampoDao;

    @Override
    public void salvar(OrcamentoCampo o) {
        try {
          orcamentoCampoDao.save(o);   
        }catch(EJBAccessException accessException){
            Msg.messagemError("Erro no EJB");
        }catch (Exception e) {
            Msg.messagemError("Erro");
        }
    }

    @Override
    public void remover(OrcamentoCampo o) {
        try {
            orcamentoCampoDao.delete(o);
        }catch(EJBAccessException accessException){
            Msg.messagemError("Erro no EJB");
        }catch (Exception e) {
            Msg.messagemError("Erro");
        }
    }

    @Override
    public void atualizar(OrcamentoCampo o) {
        try {
          orcamentoCampoDao.update(o);
        }catch(EJBAccessException accessException){
            Msg.messagemError("Erro no EJB");
        }catch (Exception e) {
            Msg.messagemError("Erro");
        }
    }

    @Override
    public List<OrcamentoCampo> orcamentos() {
        try {
           return orcamentoCampoDao.findAll();
        }catch(EJBAccessException accessException){
            Msg.messagemError("Erro no EJB");
        }catch (Exception e) {
            Msg.messagemError("Erro");
        }
        return null;
    }
}
